home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Tech Arsenal 1
/
Tech Arsenal (Arsenal Computer).ISO
/
tek-04
/
pxewin.zip
/
PXSCROLL.CPP
< prev
next >
Wrap
Text File
|
1992-02-07
|
5KB
|
172 lines
// PXEWIN - (C) Copyright 1992 by Beam Engineering, INC.
// PXSCROLL.CPP //
// Contents ----------------------------------------------------------------
//
// This module contains members for the PXScroller class.
//
// End ---------------------------------------------------------------------
// External Reference Name for this Header ---------------------------------
#ifndef PXSCROLL_CPP
#define PXSCROLL_CPP
// End ---------------------------------------------------------------------
// Interface Dependencies --------------------------------------------------
#ifndef PXSCROLL_HPP
#include "pxscroll.hpp"
#endif // PXSCROLL_HPP //
// End ---------------------------------------------------------------------
// member VScroll of PXScroller //
void PXScroller::VScroll(WORD ScrollEvent,int ThumbPos)
{
// In case the number of records changes.
my_display->my_table->NumRecs();
SetRange(my_display->RetSum(),
my_display->EngDataPtr->num_recs - 1);
switch(ScrollEvent)
{
case SB_LINEDOWN:
{
my_display->IncRec();
break;
}
case SB_LINEUP:
{
my_display->DecRec();
break;
}
case SB_THUMBPOSITION:
{
YPos = ThumbPos;
my_display->FillBoxes(YPos + 1 - my_display->item);
break;
}
case SB_PAGEDOWN:
{
my_display->FillBoxes(my_display->top_rec +
PAGE_SIZE);
break;
}
case SB_PAGEUP:
{
my_display->FillBoxes(my_display->top_rec -
PAGE_SIZE);
break;
}
}
// Scroll bars should reflect current database position.
YPos = my_display->RetCurRec() - 1;
// EndView will set the scroller to the desired position
EndView();
}
// Summary -----------------------------------------------------------------
//
// Redefine vertical scroll bars to allow scrolling through a table.
//
// Parameters
//
// ScrollEvent. This is the scroll event parameters.
//
// Thumbpos. The thumb position of the scroll bar.
//
// Return Value
//
// None.
//
// Functional Description
//
// Each vertical scroll event is redefined here. Each increment of
// YPos cooresponds to one record in the database. First check and
// make sure the range is set according to the number of records in
// the table.
//
// The following is a summary of the scrolling events and how they are
// handled:
//
// SB_LINEDOWN. Increment YPos. Call your display increment
// record routine.
//
// SB_LINEUP. Decrement YPos. Call your display decrement record
// routine.
//
// SB_THUMBPOSITION. Set YPos to thumb position. Call your display
// routine for filling the boxes. Record position starts with record
// 1 so you have to add 1 to the YPos to get the record number.
//
// SB_PAGEDOWN. Add the page size to YPos. Call your display routine
// for filling the boxes.
//
// SB_PAGEUP. Subtract the page size from YPos. Call you display
// routine for filling the boxes.
//
//
// You will notice that we have not done any range checks on YPos.
// Range checking is done in the display routine (see DBDISPLAY).
// So we call the display routine to give us the current record for
// YPos. This will be range checked. Then we can call EndView to set
// the final scroll position.
//
// End ---------------------------------------------------------------------
// member build of PXScroller //
PTStreamable PXScroller::build()
{
return new PXScroller(streamableInit);
}
TStreamableClass RegPXScroller("PXScroller",PXScroller::build,
__DELTA(PXScroller));
// Description -------------------------------------------------------------
//
// When the streamable constructor is called, TStreamable dispatches
// the build member to construct the object. To do this, it must
// know where to find this member functions for the specific class.
// This is the reason for the stream registration.
//
// End ---------------------------------------------------------------------
// member read of PXScroller //
inline Pvoid PXScroller::read(Ripstream is)
{
TScroller::read(is);
return this;
}
// Summary -----------------------------------------------------------------
//
// Call the TScroller read member.
//
// End ---------------------------------------------------------------------
// member write of PXScroller //
inline void PXScroller::write(Ropstream os)
{
TScroller::write(os);
}
// Summary -----------------------------------------------------------------
//
// Call the TScroller Write member.
//
// End ---------------------------------------------------------------------
#endif // PXSCROLL_CPP //